﻿using Sprout.Core.Paging;
using Sprout.Schedule.Dtos;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Sprout.Schedule.Interfaces
{
    public interface ITaskLogService
    {
        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="taskId">任务ID</param>
        /// <param name="content">日志内容</param>
        /// <param name="exception">异常</param>
        /// <returns></returns>
        Task LogAsync(long taskId, string content, Exception exception = null);

        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="taskId"></param>
        /// <param name="content"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        void Log(long taskId, string content, Exception exception = null);

        /// <summary>
        /// 任务日志存库
        /// </summary>
        /// <param name="pageSize"></param>
        /// <returns>写入的行数</returns>
        Task<int> Insert(int pageSize);
        /// <summary>
        /// 分页查询日志记录
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        Task<PagedList<TaskLog>> GetPaging(TaskLogQuery query);
        /// <summary>
        /// 删除日志
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<int> Delete(TaskLog dto);
    }
}
